package com.nwpu.bigdata.service.impl;

import com.nwpu.bigdata.dao.mapper.HostMapper;
import com.nwpu.bigdata.model.Host;
import com.nwpu.bigdata.model.HostExample;
import com.nwpu.bigdata.service.HostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author carlin
 * @date 2018/8/1 0001 18:20
 */
@Service
public class HostServiceImpl implements HostService {

    @Autowired
    HostMapper hostMapper;

    @Override
    public Long getHostIdByName(String hostName) {

        return hostMapper.selectHostIdByHostName(hostName);
    }

    @Override
    public List<Host> getAllHostName() {
        HostExample hostExample = new HostExample();
        HostExample.Criteria criteria = hostExample.createCriteria();
        criteria.andIsRunningEqualTo((byte) 1);//表示机器正在运行

        return hostMapper.selectByExample(hostExample);
    }

    @Override
    public List<String> getHostTypeName() {
        return null;
    }
}
